package net.melon.logger.inst.struts2;

import javax.inject.Inject;

import net.esj.basic.plugins.view.FacadeAware;
import net.esj.basic.view.PageAction;
import net.melon.logger.manage.LoggerService;
import net.melon.logger.pojo.LoggerMethod;

public class MethodAction extends PageAction<LoggerMethod, LoggerMethod> implements FacadeAware{

	private String template;
	private String theme;
	private String namespace;
	
	private LoggerService loggerService;
	
	@Override
	protected void doQueryPage() {
		pagination = loggerService.pageMethod(pagination);
	}

	@Override
	protected void doAdd() throws Exception {
		loggerService.saveMethod(entity);
	}

	@Override
	protected void doUpdate() throws Exception {
		loggerService.updateMethod(entity);
	}

	@Override
	protected void doLoad() {
		entity = loggerService.loadMethod(id);
	}

	@Override
	protected void doDelete() throws Exception {
		loggerService.deleteMethod(id);
	}

	public LoggerMethod getEntity(){
		return entity;
	}
	
	public void setEntity(LoggerMethod entity){
		this.entity = entity;
	}

	public String getTemplate() {
		return template;
	}

	public void setTemplate(String template) {
		this.template = template;
	}

	public String getTheme() {
		return theme;
	}

	public void setTheme(String theme) {
		this.theme = theme;
	}

	public String getNamespace() {
		return namespace;
	}

	public void setNamespace(String namespace) {
		this.namespace = namespace;
	}

	@Inject
	public void setLoggerService(LoggerService loggerService) {
		this.loggerService = loggerService;
	}
	
}
